<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j">

	<f:subview id="subviewPopupVeiculo">
		<rich:modalPanel id="popupVeiculo" width="750" height="470" headerClass="height:20px;" resizeable="false" >
			<f:facet name="header">
				<h:outputText value="#{bundle.veiculo_titulo_consultar}" />
			</f:facet>
			<a4j:form ajaxSubmit="true" id="formVeiculoConsulta">
				
				<center>
					<rich:extendedDataTable id="gridVeiculo" value="#{veiculoBackBean.veiculoFormBean.listaVeiculo}" var="veiculo" height="371px" sortMode="single" rows="10" selectionMode="none" lang="pt">
						<rich:column id="tabela_veiculo_selecionar" label="#{bundle.veiculo_btn_selecionar}">
							<f:facet name="header">
								<h:outputText value="#{bundle.veiculo_btn_selecionar}"/>
							</f:facet>
							<center>
								<a4j:commandLink id="btnSelecionar" reRender="formVeiculoConsulta"
												 onclick="preencheDadosPopupVeiculo('#{veiculo.codigo}', '#{veiculo.placa}');">
									<h:graphicImage width="24" value="/images/select.png" style="border:none;" >
										<rich:componentControl for="popupVeiculo" attachTo="btnSelecionar" operation="hide" event="onclick" />
									</h:graphicImage>
								</a4j:commandLink>
							</center>
						</rich:column>
						<rich:column id="tabela_veiculo_codigo" width="100" label="#{bundle.veiculo_codigo}" sortable="true" sortBy="#{veiculo.codigo}">
							<f:facet name="header">
								<h:outputText value="#{bundle.veiculo_codigo}" />
							</f:facet>
							<center>
								<h:outputText value="#{veiculo.codigo}" />
							</center>
						</rich:column>
						<rich:column id="tabela_veiculo_placa" width="100" label="#{bundle.veiculo_placa}" sortable="true" sortBy="#{veiculo.placa}">
							<f:facet name="header">
								<h:outputText value="#{bundle.veiculo_placa}"/>
							</f:facet>
							<center>
								<h:outputText value="#{veiculo.placa}"/>
							</center>
						</rich:column>
						<rich:column id="tabela_veiculo_chassi" width="100" label="#{bundle.veiculo_chassi}" sortable="true" sortBy="#{veiculo.chassi}">
							<f:facet name="header">
								<h:outputText value="#{bundle.veiculo_chassi}"/>
							</f:facet>
							<center>
								<h:outputText value="#{veiculo.chassi}"/>
							</center>
						</rich:column>
						<rich:column id="tabela_veiculo_modelo" width="200" label="#{bundle.veiculo_modelo}" sortable="true" sortBy="#{veiculo.modeloVO.descricao}">
							<f:facet name="header">
								<h:outputText value="#{bundle.veiculo_modelo}"/>
							</f:facet>
							<h:outputText value="#{veiculo.modeloVO.descricao}"/>
						</rich:column>
					</rich:extendedDataTable>
					<rich:datascroller id="dsGridVeiculo" for="gridVeiculo" renderIfSinglePage="true" maxPages="10"/>
				</center>
				
				<div class="linha"/>
				
				<a4j:commandButton action="#{veiculoBackBean.obterListaVeiculo}" value="#{bundle.veiculo_btn_consultar}" reRender="formVeiculoConsulta" />
				<a4j:commandButton value="#{bundle.veiculo_btn_novo}" actionListener="#{veiculoBackBean.listenerIrInserirVeiculo}" id="btnNovo" reRender="formVeiculoManter" disabled="#{(sistemaSession.usuarioLogado.perfil == 'ROLE_ESCRITURARIO')}">
					<rich:componentControl for="manterVeiculo" attachTo="btnNovo" operation="show" event="onclick" />
				</a4j:commandButton>
				<a4j:commandButton actionListener="#{veiculoBackBean.listenerIrConsultarVeiculo}" value="#{bundle.veiculo_btn_voltar}" id="btnVoltar" reRender="formVeiculoConsulta" >
                	<rich:componentControl for="popupVeiculo" attachTo="btnVoltar" operation="hide" event="onclick" />
                </a4j:commandButton>
				
			</a4j:form>

		</rich:modalPanel>
	</f:subview>
	
	<ui:include src="/pages/veiculo/manterVeiculo.xhtml" />
	
</html>